<template>
    <view id="certitfy">
        <view class="text1">转换比例：&nbsp<text class="text_percent">{{percent}}</text></view>
        <view>
            <view>
                <van-field
                        :value="product_name"
                        placeholder=""
                        :label="label"
                        input-align="left"
                        disabled
                        :border="has_boder"
                />
            </view>
        </view>
        <view class="text2">兑换后将获得：<text class="points">{{points}}积分</text></view>
        <view class="button-submit" @tap="commit()">
            <van-button type="info" round size="large" color="#FF9900" >确认转换</van-button>
        </view>
    </view>
</template>

<script>
    export default{
        name:"positionConversionIntegral",
        data(){
            return {
                profit_position_id:'',
                has_boder: true,
                points:'0',
                percent:'1:1',
                product_name:'',
                label:'',
            }

        },
        onLoad(query){
            this.profit_position_id=query.profit_position_id
            this.product_name=query.product_name
            this.points=query.points
        },
        onShow(){
        },
        mounted(){
        },
        methods: {
            async commit() { //确认转换
                if(this.profit_position_id!==''){
                    uni.showLoading({})
                    let res = await this.$apis.profitPositionConversionIntegral({profit_position_id:this.profit_position_id})
                    if(res.code===0){
                        uni.showToast({
                            title:"兑换成功",
                            icon:"success",
                        })
                        setTimeout(()=>{
                            this.$router.push({
                                route:this.$routesConfig.myWallet,
                            })
                            uni.hideLoading()
                        },1000)
                    }
                }

            },

        }

    }
</script>

<style lang="less" scoped>
    .button-submit{
        width: 90%;
        margin-left: 5%;
        margin-top: 10rpx;
    }
    .tips{
        position: fixed;
        width: 100%;
        bottom: 20rpx;
        font-size: 25rpx;
        text-align: center;
        color: red;
    }
    .text1{
        padding-left: 30rpx;
        margin-bottom: 50rpx;
    }
    .text_percent{
        font-size: 30rpx;
        color: #FF9502;
    }
    .points{
        font-size: 25rpx;
        color: #FF9502;
    }
    .text2{
        margin-top: 20rpx;
        font-size: 30rpx;
        padding-left: 30rpx;
        margin-bottom: 50rpx;
    }
</style>
